<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Problem Coverage</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Problem Coverage' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="index.html">inpolicy</a></li><li><a href="index.html#2">Chapter 2: Policies</a></li><li><b>Problem Coverage</b></li></ul></div>
<p class="purpose">To see which problem messages have test cases and which are linked to the documentation.</p>

<ul class="toc"><li><a href="2-pc.html#SP1">&#167;1. Observation</a></li><li><a href="2-pc.html#SP3">&#167;3. Problems which have test cases</a></li><li><a href="2-pc.html#SP4">&#167;4. Problems mentioned in documentation</a></li><li><a href="2-pc.html#SP5">&#167;5. Problems generated in the I7 source</a></li><li><a href="2-pc.html#SP7">&#167;7. Checking</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Observation.</b>Problem messages are identified by their code-names, e.g., <span class="extract"><span class="extract-syntax">PM_MisplacedFrom</span></span>;
those names should be unique, but any number of problems can instead be
marked with one of three special names.
</p>

<p class="commentary">Problems can be mentioned in the code, in the documentation, or in the
set of Inform test cases.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">    </span><span class="constant-syntax">0x00000001</span><span class="plain-syntax"> </span><span class="comment-syntax"> mentioned in test cases</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">   </span><span class="constant-syntax">0x00000002</span><span class="plain-syntax"> </span><span class="comment-syntax"> mentioned in documentation</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">  </span><span class="constant-syntax">0x00000004</span><span class="plain-syntax"> </span><span class="comment-syntax"> mentioned in source code</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">IMPOSSIBLE_PCON</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00000008</span><span class="plain-syntax"> </span><span class="comment-syntax"> this is </span><span class="extract"><span class="extract-syntax">BelievedImpossible</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">UNTESTABLE_PCON</span><span class="plain-syntax">     </span><span class="constant-syntax">0x00000010</span><span class="plain-syntax"> </span><span class="comment-syntax"> this is </span><span class="extract"><span class="extract-syntax">Untestable</span></span>
<span class="definition-keyword">define</span> <span class="constant-syntax">NAMELESS_PCON</span><span class="plain-syntax">       </span><span class="constant-syntax">0x00000020</span><span class="plain-syntax"> </span><span class="comment-syntax"> this is </span><span class="extract"><span class="extract-syntax">...</span></span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">known_problem</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">contexts_observed</span><span class="plain-syntax">; </span><span class="comment-syntax"> bitmap of the above bits</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">contexts_observed_multiple_times</span><span class="plain-syntax">; </span><span class="comment-syntax"> bitmap of the above bits</span>
<span class="plain-syntax">    </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">known_problem</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure known_problem is accessed in 2/trs, 4/prp, 4/jsn, 5/mrk, 5/mv, 5/im, 7/ld, 1/wcl, 1/cln, 1/ws, 2/wn, 2/hs, 3/pl, 4/cs, 5/ts, 5/ptt, 5/wt, 6/rw and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>When a problem is observed, we create a dictionary entry for it, if necessary,
and augment its bitmap of known contexts:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">problems_dictionary</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::observe_problem</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">Coverage::observe_problem</span></span>:<br/><a href="2-pc.html#SP3">&#167;3</a>, <a href="2-pc.html#SP4">&#167;4</a>, <a href="2-pc.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">problems_dictionary</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">problems_dictionary</span><span class="plain-syntax"> = </span><a href="../foundation/2-dct.html#SP2" class="function-link"><span class="function-syntax">Dictionaries::new</span></a><span class="plain-syntax">(1000, </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">known_problem</span><span class="plain-syntax"> *</span><span class="identifier-syntax">KP</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/2-dct.html#SP5" class="function-link"><span class="function-syntax">Dictionaries::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">problems_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KP</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">known_problem</span><span class="plain-syntax"> *) </span><a href="../foundation/2-dct.html#SP8" class="function-link"><span class="function-syntax">Dictionaries::read_value</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">problems_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KP</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">known_problem</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="../foundation/2-dct.html#SP5" class="function-link"><span class="function-syntax">Dictionaries::create</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">problems_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="../foundation/2-dct.html#SP8" class="function-link"><span class="function-syntax">Dictionaries::write_value</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">problems_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">KP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">name</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed_multiple_times</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">context</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed_multiple_times</span><span class="plain-syntax"> |= </span><span class="identifier-syntax">context</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed</span><span class="plain-syntax"> |= </span><span class="identifier-syntax">context</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. Problems which have test cases.</b>Here we ask Intest to produce a roster of all known test cases, then parse
this back to look for cases whose names have the <span class="extract"><span class="extract-syntax">PM_...</span></span> format. Those are
the problem message test cases, so we observe them.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::which_problems_have_test_cases</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">Coverage::which_problems_have_test_cases</span></span>:<br/><a href="2-pc.html#SP7_1">&#167;7.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">CAT</span><span class="plain-syntax"> = </span><a href="../foundation/3-fln.html#SP2" class="function-link"><span class="function-syntax">Filenames::in</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">path_to_inpolicy_workspace</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"cases.txt"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">COMMAND</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">COMMAND</span><span class="plain-syntax">, </span><span class="string-syntax">"..%cintest%cTangled%cintest inform7 -catalogue "</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="constant-syntax">FOLDER_SEPARATOR</span><span class="plain-syntax">, </span><span class="constant-syntax">FOLDER_SEPARATOR</span><span class="plain-syntax">, </span><span class="constant-syntax">FOLDER_SEPARATOR</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-shl.html#SP4" class="function-link"><span class="function-syntax">Shell::redirect</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">COMMAND</span><span class="plain-syntax">, </span><span class="identifier-syntax">CAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/3-shl.html#SP5" class="function-link"><span class="function-syntax">Shell::run</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">COMMAND</span><span class="plain-syntax">)) </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"can't run intest to harvest cases"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">COMMAND</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="../foundation/4-tf.html#SP5" class="function-link"><span class="function-syntax">TextFiles::read</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">CAT</span><span class="plain-syntax">, </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">, </span><span class="string-syntax">"unable to read roster of test cases"</span><span class="plain-syntax">, </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        &amp;</span><a href="2-pc.html#SP3" class="function-link"><span class="function-syntax">Coverage::test_case_harvester</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::test_case_harvester</span><span class="plain-syntax">(</span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::create_mr</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-pm.html#SP10" class="function-link"><span class="function-syntax">Regexp::match</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(PM_%C+)%c*"</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP2" class="function-link"><span class="function-syntax">Coverage::observe_problem</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[0], </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::dispose_of</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Problems mentioned in documentation.</b>Here we look through the "Writing with Inform" source text for cross-references
to problem messages:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::which_problems_are_referenced</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">Coverage::which_problems_are_referenced</span></span>:<br/><a href="2-pc.html#SP7_1">&#167;7.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP5" class="function-link"><span class="function-syntax">Pathnames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"resources"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP4" class="function-link"><span class="function-syntax">Pathnames::down</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Documentation"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">WWI</span><span class="plain-syntax"> = </span><a href="../foundation/3-fln.html#SP2" class="function-link"><span class="function-syntax">Filenames::in</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Writing with Inform.md"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/4-tf.html#SP5" class="function-link"><span class="function-syntax">TextFiles::read</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">WWI</span><span class="plain-syntax">, </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">, </span><span class="string-syntax">"unable to read 'Writing with Inform' source text"</span><span class="plain-syntax">, </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        &amp;</span><a href="2-pc.html#SP4" class="function-link"><span class="function-syntax">Coverage::xref_harvester</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::xref_harvester</span><span class="plain-syntax">(</span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::create_mr</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><a href="../foundation/4-pm.html#SP10" class="function-link"><span class="function-syntax">Regexp::match</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%c*)%{(PM_%C+?)%}(%c*)"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP2" class="function-link"><span class="function-syntax">Coverage::observe_problem</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[1], </span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="../foundation/4-sm.html#SP15" class="function-link"><span class="function-syntax">Str::clear</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="string-syntax">"%S%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[0], </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[2]);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::dispose_of</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. Problems generated in the I7 source.</b>Which is to say, actually existing problem messages.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::which_problems_exist</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">Coverage::which_problems_exist</span></span>:<br/><a href="2-pc.html#SP7_1">&#167;7.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tools</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP7" class="function-link"><span class="function-syntax">Pathnames::up</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">path_to_inpolicy</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">path_to_inform7</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP4" class="function-link"><span class="function-syntax">Pathnames::down</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tools</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"inform7"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">wcl_declaration</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="1-wcl.html#SP30" class="function-link"><span class="function-syntax">WCL::read_web</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">path_to_inform7</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">ls_web</span><span class="plain-syntax"> *</span><span class="identifier-syntax">Wm</span><span class="plain-syntax"> = </span><a href="1-ws.html#SP1" class="function-link"><span class="function-syntax">WebStructure::from_declaration</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">ls_chapter</span><span class="plain-syntax"> *</span><span class="identifier-syntax">Cm</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">Cm</span><span class="plain-syntax">, </span><span class="reserved-syntax">ls_chapter</span><span class="plain-syntax">, </span><span class="identifier-syntax">Wm</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">chapters</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">ls_section</span><span class="plain-syntax"> *</span><span class="identifier-syntax">Sm</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">Sm</span><span class="plain-syntax">, </span><span class="reserved-syntax">ls_section</span><span class="plain-syntax">, </span><span class="identifier-syntax">Cm</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">sections</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">SF</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Sm</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">source_file_for_section</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><a href="../foundation/4-tf.html#SP5" class="function-link"><span class="function-syntax">TextFiles::read</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">SF</span><span class="plain-syntax">, </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">, </span><span class="string-syntax">"unable to read section page from 'inform7'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">, &amp;</span><a href="2-pc.html#SP6" class="function-link"><span class="function-syntax">Coverage::existence_harvester</span></a><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, (</span><span class="reserved-syntax">void</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">SF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>So now we have to read a section, looking for the existence of problem
messages:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::existence_harvester</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">Coverage::existence_harvester</span></span>:<br/><a href="2-pc.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">SF</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">state</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::create_mr</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><a href="../foundation/4-pm.html#SP10" class="function-link"><span class="function-syntax">Regexp::match</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%c*?)_p_%((%c+?)%)(%c*)"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="../foundation/4-sm.html#SP15" class="function-link"><span class="function-syntax">Str::clear</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="string-syntax">"%S%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[0], </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[2]);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="../foundation/4-sm.html#SP17" class="function-link"><span class="function-syntax">Str::copy</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[1]);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP19" class="function-link"><span class="function-syntax">Str::eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"sigil"</span><span class="plain-syntax">)) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">context</span><span class="plain-syntax"> = </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP19" class="function-link"><span class="function-syntax">Str::eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"BelievedImpossible"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">context</span><span class="plain-syntax"> = </span><span class="constant-syntax">IMPOSSIBLE_PCON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="string-syntax">"_%f_line%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">SF</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">line_count</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP19" class="function-link"><span class="function-syntax">Str::eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Untestable"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">context</span><span class="plain-syntax"> = </span><span class="constant-syntax">UNTESTABLE_PCON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="string-syntax">"_%f_line%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">SF</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">line_count</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP19" class="function-link"><span class="function-syntax">Str::eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"..."</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">context</span><span class="plain-syntax"> = </span><span class="constant-syntax">NAMELESS_PCON</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="string-syntax">"_%f_line%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">SF</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">line_count</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP2" class="function-link"><span class="function-syntax">Coverage::observe_problem</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">context</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::dispose_of</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Checking.</b>So the actual policy-enforcement routine is here:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">observations_made</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::check</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">Coverage::check</span></span>:<br/>Main - <a href="1-mn.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">observations_made</span><span class="plain-syntax"> == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-pc.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Perform the observations</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">observations_made</span><span class="plain-syntax"> = </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">all_is_well</span><span class="plain-syntax"> = </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-pc.html#SP7_2" class="named-paragraph-link"><span class="named-paragraph">Report and decide how grave the situation is</span><span class="named-paragraph-number">7.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">all_is_well</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"All is well.\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"This needs attention.\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">all_is_well</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Perform the observations</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-pc.html#SP3" class="function-link"><span class="function-syntax">Coverage::which_problems_have_test_cases</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP4" class="function-link"><span class="function-syntax">Coverage::which_problems_are_referenced</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP5" class="function-link"><span class="function-syntax">Coverage::which_problems_exist</span></a><span class="plain-syntax">();</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pc.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_2" class="paragraph-anchor"></a><b>&#167;7.2. </b>Okay, so that's all of the scanning done; now to report on it.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Report and decide how grave the situation is</span><span class="named-paragraph-number">7.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%d problem name(s) have been observed:\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NUMBER_CREATED</span><span class="plain-syntax">(</span><span class="reserved-syntax">known_problem</span><span class="plain-syntax">)); </span><span class="constant-syntax">INDENT</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"Problems actually existing (the source code refers to them):\n"</span><span class="plain-syntax">); </span><span class="constant-syntax">INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are named and in principle testable"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are named more than once:"</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">all_is_well</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">IMPOSSIBLE_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">IMPOSSIBLE_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are 'BelievedImpossible', that is, no known source text causes them"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">UNTESTABLE_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">UNTESTABLE_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are 'Untestable', that is, not mechanically testable"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">NAMELESS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">NAMELESS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are '...', that is, they need to be give a name and a test case"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="constant-syntax">OUTDENT</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"Problems which should have test cases:\n"</span><span class="plain-syntax">); </span><span class="constant-syntax">INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"have test cases"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"have no test case yet:"</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are spurious test cases, since no such problems exist:"</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">all_is_well</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CASE_EXISTS_PCON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="constant-syntax">OUTDENT</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"Problems which are cross-referenced in 'Writing with Inform':\n"</span><span class="plain-syntax">); </span><span class="constant-syntax">INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are cross-referenced"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are cross-referenced more than once:"</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">all_is_well</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::cite</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">I</span><span class="string-syntax">"are spurious references, since no such problems exist:"</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">all_is_well</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><a href="2-pc.html#SP8" class="function-link"><span class="function-syntax">Coverage::list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_MENTIONS_PCON</span><span class="plain-syntax">+</span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="constant-syntax">DOC_MENTIONS_PCON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="constant-syntax">OUTDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">OUTDENT</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-pc.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::cite</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">Coverage::cite</span></span>:<br/><a href="2-pc.html#SP7_2">&#167;7.2</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">mask</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">mask2</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">message</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">known_problem</span><span class="plain-syntax"> *</span><span class="identifier-syntax">KP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">KP</span><span class="plain-syntax">, </span><span class="reserved-syntax">known_problem</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">mask</span><span class="plain-syntax">) == </span><span class="identifier-syntax">val</span><span class="plain-syntax">) </span><span class="identifier-syntax">N</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed_multiple_times</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">mask2</span><span class="plain-syntax">) == </span><span class="identifier-syntax">val</span><span class="plain-syntax">) </span><span class="identifier-syntax">N</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">N</span><span class="plain-syntax">&gt;0) &amp;&amp; (</span><span class="identifier-syntax">message</span><span class="plain-syntax">)) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%d problem(s) %S\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">message</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Coverage::list</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">Coverage::list</span></span>:<br/><a href="2-pc.html#SP7_2">&#167;7.2</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">mask</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">mask2</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="constant-syntax">INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">known_problem</span><span class="plain-syntax"> *</span><span class="identifier-syntax">KP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">KP</span><span class="plain-syntax">, </span><span class="reserved-syntax">known_problem</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">mask</span><span class="plain-syntax">) == </span><span class="identifier-syntax">val</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            ((</span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">contexts_observed_multiple_times</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">mask2</span><span class="plain-syntax">) == </span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">KP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    </span><span class="constant-syntax">OUTDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="1-mn.html">&#10094;</a></li><li class="progresschapter"><a href="M-ui.html">M</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresscurrent">pc</li><li class="progresssection"><a href="2-kv.html">kv</a></li><li class="progresssection"><a href="2-ev.html">ev</a></li><li class="progressnext"><a href="2-kv.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

